package com.bocom.service.impl;

import com.bocom.dao.*;
import com.bocom.service.InterfaceAPIService;
import com.bocom.vo.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Author shenzhifeng
 * Create time  2019/8/26 14:57
 * Description
 * Modifier
 * Reasons
 */
@Service
public class InterfaceAPIServiceImpl implements InterfaceAPIService {

    @Resource
    private InterfaceAPIDao interfaceAPIDao;

    @Resource
    private AlarmInfoDao alarmInfoDao;

    @Resource
    private TruckPositionDao truckPositionDao;

    @Resource
    private BusInfoDao busInfoDao;

    @Resource
    private BusSiteInfoDao busSiteInfoDao;

    @Resource
    private BusPersonInfoDao busPersonInfoDao;

    @Resource
    private BusFrequencyDao busFrequencyDao;

    @Resource
    private BusGpsDao busGpsDao;

    @Resource
    private BusPicDao busPicDao;

    @Override
    public int insert(Map<String, Object> map) {
        return interfaceAPIDao.insert(map);
    }

    @Override
    public int insertPhoto(Map<String, Object> map) {
        return interfaceAPIDao.insertPhoto(map);
    }

    @Override
    public int insertSecurityLanes(Map<String, Object> map) {
        return interfaceAPIDao.insertSecurityLanes(map);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insertTruckBase(List<TruckBase> list) {
        interfaceAPIDao.truncateTable();
        return interfaceAPIDao.insertTruckBase(list);
    }

    @Override
    public int insertTruckPosition(List<TruckPosition> list) {
        return truckPositionDao.insertTruckPosition(list);
    }

    @Override
    public int insertAlarmInfo(List<AlarmInfo> list) {
        return alarmInfoDao.insertAlarmInfo(list);
    }


    @Override
    public int insertBusSiteInfo(BusSiteInfo record) {
        return busSiteInfoDao.insertBusSiteInfo(record);
    }

    @Override
    public int insertBusInfo(BusInfo record) {
        return busInfoDao.insertBusInfo(record);
    }

    @Override
    public int insertBusPersonInfo(BusPersonInfo record) {
        return busPersonInfoDao.insertBusPersonInfo(record);
    }

    @Override
    public int insertBusFrequency(BusFrequency record) {
        return busFrequencyDao.insertBusFrequency(record);
    }

    @Override
    public int insertBusGps(BusGps record) {
        return busGpsDao.insertBusGps(record);
    }

    @Override
    public int insertBusPic(BusPic record) {
        return busPicDao.insertBusPic(record);
    }


}
